<%-- 
    Document   : bill
    Created on : Apr 11, 2011, 11:38:40 AM
    Author     : Nguyen Hung
--%>

<%@page import="java.text.NumberFormat"%>
<%@page import="java.util.ArrayList"%>
<%@page import="Business.LineItem"%>
<%@page import="java.sql.Date"%>
<%@page import="Business.Customer"%>
<%@page import="Business.Order"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="../WEB-INF/jspf/headeradmin.jspf" %>
        
   
        <%
            Order order = (Order)request.getAttribute("order");
            Customer customer =order.getCustomer();
            Date date = order.getDate();
              NumberFormat nf = NumberFormat.getInstance();
                //nf.setMinimumFractionDigits(2);
                nf.setMaximumFractionDigits(2);
        %>
        <div>
            <table width="512" border="1" align="center">
                <caption>
                    <strong>Thông Tin Đơn Hàng    </strong>
                </caption>
                <tr>
                    <th width="170">Họ Tên Khách Hàng</th>
                    <td width="326"><%=customer.getName()%></td>
                </tr>
                <tr>
                    <th>Địa Chỉ giao Hàng</th>
                    <td><%=customer.getAddress()%></td>
                </tr>
                <tr>
                    <th>Số Điện Thoại</th>
                    <td><%=customer.getPhoneNumber()%></td>
                </tr>
                <tr>
                    <th>Số Tài Khoản</th>
                    <td><%=customer.getCreditCardNumber()%></td>
                </tr>
                <tr>
                    <th>Ghi Chú</th>
                    <%
                        if(order.getNote() != null){
                    %>
                    <td><%=order.getNote()%></td>
                    <%}
                    %>
                </tr>
                <tr>
                    <th>Ngày Đặt Hàng</th>
                    <td><%=date.getDate()+ "/"+date.getMonth() + "/" +date.getYear()%></td>
                </tr>
                <tr>
                    <th>Tổng Giá Trị</th>
                    <td><%=nf.format(order.getTotal())%></td>
                </tr>
            </table>
        </div>

        <div>
            <%
               ArrayList<LineItem> items = order.getLineItems();
            %>
            <table width="629" border="1" align="center">
                <tr>
                    <th>Số TT</th>
                    <th>Mã Mặt Hàng</th>
                   
                    <th>Số Lượng</th>
                    <th width="206">Thành Tiền</th>
                </tr>
                <%
                    for(int i = 0; i < items.size(); i++){
                        LineItem item = items.get(i);
                %>
                <tr>
                    <td width="67"><%=i%></td>
                    <td width="100"><%=item.getProduct().getProductCode()%></td>
                    <td width="130"><%=item.getQuantity()%></td>
                    <td><%=nf.format(item.getTotal())%></td>
                    
                </tr>
                <%
                }
                %>


            </table>

        </div>
<%@include file="../WEB-INF/jspf/footeradmin.jspf" %>
